#ifndef COMPONENTMOVABLE_H
#define COMPONENTMOVABLE_H


#include "ComponentPosition.h"


class ComponentMovable : public Component
{
    public:
    ComponentMovable(ComponentManager* _parent, ComponentArguments _args);
    virtual ~ComponentMovable();

    virtual void initialize();
    virtual void destroy();

    virtual void saveToXML(TiXmlElement* parentElement);
    virtual void loadFromXML(TiXmlElement* parentElement);

    virtual void update(double timeSinceLastFrame);
    virtual void registerNewComponent(std::string _newComponentName);


    void goToOrder(Ogre::Vector3 _position);
    void goToOrder(Ogre::Vector2 _position);

    void walk(double timeSinceLastFrame);

    void addWayPoints(std::list<Ogre::Vector2> list);
    void addWayPointsAfterClear(std::list<Ogre::Vector2> list);
    void clearWayPoints();

    float getDistanceFromWalkTarget();


    protected:
    private:
    ComponentPosition* m_positionComponent;

    std::list<Ogre::Vector2> m_waypoints;

    Ogre::Vector3 m_direction;
    Ogre::Vector3 m_target;
    float m_speed;

    bool m_isAtTarget;



};

#endif // COMPONENTMOVABLE_H
